from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    # 第一步搜索
    def souso(self):
        loc=(By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜商品名称 作者 出版社 ISBN")')
        ele=self.find_loc(loc)
        return ele
    # 第二步输入搜索内容
    def ersou(self):
        loc = (By.CLASS_NAME,'android.widget.EditText')
        ele = self.find_loc(loc)
        return ele
    # 第三步点击搜索按钮
    def anniusou(self):
        loc = (By.ID,'com.kongfz.app:id/tvSearch')
        ele = self.find_loc(loc)
        return ele
    # 第四步点击商品信息
    def xinxi(self):
        loc = (By.XPATH,'(//android.widget.ImageView[@resource-id="com.kongfz.app:id/ivPic"])[7]')
        ele = self.find_loc(loc)
        return ele
    # 加入购物车
    def jirugouwuche(self):
        loc=(By.XPATH,'//android.widget.RelativeLayout[@resource-id="com.kongfz.app:id/rlAddCart"]')
        ele=self.find_loc(loc)
        return ele
    # 断言1
    def duanyan1(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tv1" and @text="作者"]')
        ele=self.find_loc(loc)
        return ele
    # 断言2
    def duanyan2(self):
        loc=(By.XPATH,'//android.widget.TextView[@resource-id="com.kongfz.app:id/tv1" and @text="出版社"]')
        ele=self.find_loc(loc)
        return ele